object ScalaImplicitDemo02 {
  def main(args: Array[String]): Unit = {
    /**
     * 隐式函数，丰富MYSQL功能
     * @param mysql
     * @return
     */
    implicit def addDelete(mysql: MySQL): DB = {
      new DB
    }
    // 创建mysql对象
    val mysql = new MySQL
    mysql.insert()
    // 编译器⼯作，addDelete$1(mysql).delete()
    mysql.delete()
    mysql.update()
  }
}
class MySQL {
  def insert(): Unit = {
    println("insert")
  }
}
class DB {
  def delete(): Unit = {
    println("delete")
  }
  def update(): Unit = {
    println("update")
  }
}
class Dog {
}